package com.summer.safe.config.aop.noRepeat;

import java.util.concurrent.TimeUnit;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;

/**
 * @Description 内存缓存，防止重复提交数据使用
 */
@Configuration
public class UrlCache {

    @Bean
    public Cache<String, Integer> getCache() {
        return CacheBuilder.newBuilder().expireAfterWrite(5L, TimeUnit.SECONDS).build();    // 缓存有效期为5秒
    }
}
